# utf-8
from typing import List


class Solution:
    def maxProfit(self, prices: List[int]) -> int:
        diff = [0,]
        for i in range(1, len(prices)):
            diff.append(prices[i] - prices[i-1])
        sum = 0
        for v in diff:
            if v <= 0:
                continue
            sum = sum + v
        return sum
 
